﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Cwt;

namespace WebApp._Management._Article
{
    public partial class Delete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid id = new Guid(Request.QueryString["id"]);

            ICwtService service = Global.Get<ICwtService>();
            Article article = service.FindArticle(id);
            if (article != null)
            {
                if (service.DeleteArticle(article))
                {
                    Response.Write("<script>alert('删除成功!');window.location.href='./List.aspx';</script>");
                }
                else
                {
                    Response.Write("<script>alert('删除失败!');window.location.href='./List.aspx';</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('删除失败!');window.location.href='./List.aspx';</script>");
            }
        }
    }
}